package org.lc.stk.service.question;

import org.lc.stk.web.dto.question.ChoiceQuestionDTO;

/**
 * 选择题服务接口
 */
import org.lc.stk.web.dto.question.ChoiceQuestionDTO;

public interface ChoiceQuestionService extends QuestionService<ChoiceQuestionDTO> {
    
    /**
     * 验证选项序号是否连续
     */
    boolean validateOptionIndexes(ChoiceQuestionDTO questionDTO);
    
    /**
     * 验证答案选项是否有效
     */
    boolean validateAnswerIndexes(ChoiceQuestionDTO questionDTO);
    
    /**
     * 验证多选题至少选择两个答案
     */
    boolean validateMultipleAnswers(ChoiceQuestionDTO questionDTO);
    
    @Override
    default boolean validate(ChoiceQuestionDTO dto) {
        return validateOptionIndexes(dto) &&
               validateAnswerIndexes(dto) &&
               validateMultipleAnswers(dto);
    }
}